<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <link rel="shortcut icon" href="images/favicon.ico"/>
        <title>JForum :: #{resourcesController.extractResource('REGISTRATION')}</title>
    </h:head>
    <h:body style="background-color: #111111">
        
       <div id="header">
		<ui:insert name="header" >
			<ui:include src="header.xhtml" />
		</ui:insert>
       </div>
        
       <center>
          
              <p:panel header="#{resourcesController.extractResource('NEW_USER_REG')}" 
                       style="width:790px">
                  <div align="center">
                    <h:form>
                      <p:growl id="messageGrowl" showDetail="true"/>
                      <h:panelGrid cellspacing="5"
                                   cellpadding="5"
                                   columns="3">
                            #{resourcesController.extractResource('USERNAME')}
                            <p:inputText value="#{registrationBean.username}"
                                         size="39"
                                         id="username"
                                         required="true"
                                         requiredMessage="#{resourcesController.extractResource('USERNAME_REQUIRED')}">
                                <p:ajax event="blur"/>
                            </p:inputText>
                            <p:message id="usernamemsg" for="username" display="text"/>

                            #{resourcesController.extractResource('PASSWORD')}
                            <p:password value="#{registrationBean.password}"
                                         feedback="true"
                                         maxlength="18"
                                         id="password"
                                         size="39"
                                         required="true"
                                         requiredMessage="#{resourcesController.extractResource('PASSWORD_REQUIRED')}">
                                <p:ajax event="blur"/>
                            </p:password>
                            <p:message id="passwordmsg" for="password" display="text"/>

                            #{resourcesController.extractResource('PASSWORD_ACCEPT')}
                            <p:password  value="#{registrationBean.acceptPassword}"
                                         feedback="true"
                                         maxlength="18"
                                         id="acceptpassword"
                                         size="39"
                                         required="true"
                                         requiredMessage=" #{resourcesController.extractResource('PASSWORD_ACCEPT_REQUIRED')}">
                                <p:ajax event="blur" />
                            </p:password>
                            <p:message id="acceptmsg" for="acceptpassword" display="text"/>

                            #{resourcesController.extractResource('EMAIL_ADDRESS')}
                            <p:inputText value="#{registrationBean.email}"
                                             id="email"
                                             size="39"
                                             required="true"
                                             requiredMessage="#{resourcesController.extractResource('EMAIL_ADDRESS_REQUIRED')}">
                                <f:validateLength maximum="30" />
                                <p:ajax event="blur"/>
                            </p:inputText>
                            <p:message id="emailmsg" for="email" display="text"/>

                          </h:panelGrid>

                          
                             <p:commandButton action="#{registrationBean.createAccount()}"
                                              update="messageGrowl"
                                              style="margin-top: 10px"
                                              value="#{resourcesController.extractResource('CREATE_ACCOUNT')}" />
                            
                        </h:form>
                        <h:form enctype="multipart/form-data"> 
                            <p:fileUpload fileUploadListener="#{registrationBean.handleFileUpload}"
                                              style="margin-top: 10px"
                                              cancelLabel="#{resourcesController.extractResource('ABORT')}"
                                              uploadLabel="#{resourcesController.extractResource('UPLOAD')}"
                                              label="#{resourcesController.extractResource('CHOOSE_AVATAR')}"
                                              allowTypes="/(\.|\/)(png)$/"
                                              mode="advanced"
                                              update="@all"
                                              sizeLimit="100000"
                                              invalidSizeMessage="#{resourcesController.extractResource('ILLEGAL_IMAGE_SIZE')}"
                                              invalidFileMessage="#{resourcesController.extractResource('ILLEGAL_IMAGE_FORMAT')}"/>
                        </h:form>
                        
                 </div>
                 
            </p:panel>
          
        </center> 
        <ui:insert name="header" >
			<ui:include src="footer.xhtml" />
        </ui:insert>
    </h:body>
</html>

